/*
 * @Author: TalkMan
 * @Date: 2021-05-31 8:51:03
 * @LastEditTime: 2021-05-31 14:15:13
 * @LastEditors: TalkMan
 * @Description: 农资库存接口
 */

import xjaxios from "@/api/axios";
// import { start } from "nprogress";

export default {
  /**
   * @description: 获取农资库存信息 *代表必填
   * @param {String/Number} page *
   * @param {String/Number} size *
   * @param {Object} entity {componyId: 1} *
   * @param {String} order 排序方式 ASC DESC 默认ASC
   * @param {String} sort 自定义排序方式 'createTime'
   * @return {Array}
   *
   */
  getAgriMateVentoryList(params) {
    return xjaxios.post("/material/queryPageList", {
      page: params.page,
      size: params.size,
      entity: {
        // organizationNo: sessionStorage.organizationNo,
        agriculturalMaterialInventoryIdList: []
      }
    });
  },
  queryAgriMateVentoryList(params) {
    return xjaxios.post("/material/queryPageList", params);
  },

  // queryAll: () => xjaxios.get("/material/getAll"),

  // del: id => xjaxios.get(`/material/del/${id}`),

  /**
   * @description: 农资图片上传
   * @param {Strign} picture *
   * @return {Object}
   */
  uploadAgriMateInventory(formData) {
    return xjaxios.post("/collectionPicture/addPicture", formData);
  },

  /**
   * @description: 农资图片主键查询
   * @param {Strign} agriculturalMaterialPictureId *
   * @return {Object}
   */
  queryPictureById(pictureId) {
    return xjaxios.get(`/collectionPicture/query/${pictureId}`);
  },

  delPictureById: pictureId =>
    xjaxios.get(`/collectionPicture/del/${pictureId}`)
};
